﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AdminSite.Master" Inherits="System.Web.Mvc.ViewPage<TanHungViet.Web.Models.Content>" %>
<%@ Import Namespace="TanHungViet.Helper"%>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Chỉnh Sửa Nội Dung - PHẦN MỀM XÂY DỰNG – TÂN HƯNG VIỆT – 0835.125.795
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="CssJsRef" runat="server">
    <script type='text/javascript' language='javascript' src='<%= Url.Content("~/ckeditor/ckeditor.js") %>'></script>
    <script type='text/javascript' language='javascript' src='<%= Url.Content("~/Scripts/$uery-ui-1.8.16.custom.min.js") %>'></script>
    
    <script type="text/javascript">
        $(function() {
            $("#tabs").tabs({ fx: [{ opacity: 'toggle', duration: 'normal' },   // hide option
                            {opacity: 'toggle', duration: 'fast'}]
            });
        });

        function Cancel() {
            window.location = '/QuanLyNoiDung';
        }

        function Validate() {
            // validate name
            var errorTitle = false;
            var errorTitleMsg = "";
            var title = $("#ContentTitle").val();
            if (title == '') {
                errorTitleMsg = "Tiêu đề tin tức không được bỏ trống!";
                errorTitle = true;
            }

            // validate detail
            var errorContent = false;
            var errorContentMsg = "";
            //            var content = $("#ContentDetail").val();
            //            if (content == '') {
            //                errorContentMsg = "Nội dung tiếng Việt không được bỏ trống";
            //                errorContent = true;
            //            }

            if (errorTitle == true || errorContent == true) {
                $("#error-title").html(errorTitleMsg);
                $("#error-content").html(errorContentMsg);
                return false;
            }
            else {
                $("#error-title").html('');
                $("#error-content").html('');
                return true;
            }
        }

        function Submit() {
            if (Validate())
                document.forms[0].submit();
        }
	    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="title-mainright1">
	    <h2 class="text1"><%= ViewData["ContentTitle"]%></h2>
    </div>
    
    <% Html.EnableClientValidation(); %> 
    <% using (Html.BeginForm("ThemSuaTinTuc", "QuanLyNoiDung", FormMethod.Post, new { id = "form-news", enctype = "multipart/form-data" }))
       {%>
	<div class="content1">
		<div class="top-box2"><img src='<%=Url.Content("~/Content/images/top-box21.jpg")%>'/> </div>		
			<div class="center-box21">
			  <div style="margin-left:50px;">
                    <label><span style="color:Orange;"><b>Hình đại diện</b></span></label>
	                <br />
	                <table>
	                    <tr>
	                        <td><img src="<%= Url.Content(Constant.ImageContentPath + Model.ContentImage ?? string.Empty) %>" alt="" width="150px" height="100px"/></td>
	                        <td><input id="file" type="file" name="file" /></td>
	                    </tr>
	                </table> 
                    
	                <p>
	                    <label><span style="color:Orange;"><b>Tiêu đề</b></span></label>
	                    <br />
	                    <%= Html.TextBoxFor(b => b.ContentTitle, new { size = "100" })%>
	                    <span id="error-title" style="color:#FF0000"></span>
	                </p>
	                
	                <p>
	                    <label><span style="color:Orange;"><b>Tóm tắt</b></span></label>
	                    <br />
	                    <%= Html.TextAreaFor(b => b.BriefDescrip, new { rows = "5", cols = "99" })%>
	                </p>
	                    <label><span style="color:Orange;"><b>Nội dung</b></span></label>
	                    <br />
	                    <br />
	                    <%= Html.TextArea("ContentDetail") %>
	                    <span id="error-content" style="color:#FF0000"></span>
	                    <script type="text/javascript">
	                        CKEDITOR.replace('ContentDetail',
                            {
                                width: 800,
                                height: 500,
                                toolbarCanCollapse: false,
                                removePlugins: 'elementspath',
                                uiColor: '#DCDCDC',
                                filebrowserImageBrowseUrl: '/ckeditor/ImageBrowser.aspx?ImageFolderRoot=~/Content/images_content_detail/'
                            });
	                    </script>
	                </p>
	                <br />
                    <input type="button" class="button" value="Lưu lại" onclick="Submit()" /> &nbsp;&nbsp;&nbsp;
                    <input type="button" class="button" value="Hủy bỏ" onclick="Cancel()" />
	               </div> 
			</div>            	
		<div class="bottom-box2"><img src='<%=Url.Content("~/Content/images/bottom-box21.jpg")%>'	></div>
	</div> 
	
	<%= Html.HiddenFor(b=>b.ContentID) %>
    <input type="hidden" name="content-type" id="content-type" value="<%= ViewData["ContentType"] %>" />
    <%} %>
</asp:Content>



